
<h1><?php echo __('Categories List') ?></h1>

<?php include_partial('global/searchForm', array('actionUrl'  => url_for('category/index'), 'formFilter' => $formFilter)) ?>
<?php if ($maxUser->getMaxUserRole()->canAdd()): ?>
    <a class="addNewItem right button noClear" href="<?php echo url_for('category/new') ?>"><?php echo __('New') ?></a>
<?php endif; ?>
<table class="table adminGrid">
    <thead>
        <tr>
            <th><?php echo __('Title') ?></th>
            <th><?php echo __('Description') ?></th>
            <th><?php echo __('Jobs number') ?></th>
            <th><?php echo __('Image') ?></th>
            <th><?php echo __('Need check') ?></th>
            <th><?php echo __('Statues') ?></th>
            <?php if ($maxUser->getMaxUserRole()->canEdit()): ?>
                <th><?php echo __('Edit') ?></th>
            <?php endif; ?>
            <?php if ($maxUser->getMaxUserRole()->canDelete()): ?>
                <th><?php echo __('Delete') ?></th>
            <?php endif; ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($pager->getResults() as $category): ?>
            <tr>
                <td><?php echo $category->getTitle() ?></td>
                <td><?php echo $category->getDescription() ?></td>
                <td><?php echo $category->getJobsNumber() ?></td>
                <td><img src="<?php echo url_for('@RenderImage?type=cat&width=60&height=50&imageName=' . $category->image) ?>" width="60" height="50" /></td>
                <td><?php echo $category->getNeedCheck() ?></td>
                <td><?php echo $category->getStatuesTitle() ?></td>
                <?php if ($maxUser->getMaxUserRole()->canEdit()): ?>
                    <td><?php echo link_to(__('Edit'), 'category/edit?id=' . $category->getId()) ?></td>
                <?php endif; ?>
                <?php if ($maxUser->getMaxUserRole()->canDelete()): ?>
                    <td><?php echo link_to(__('Delete'), 'category/delete?id=' . $category->getId(), array('method'  => 'delete', 'confirm' => __('Are you sure?'))) ?></td>
                <?php endif; ?>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table> 
<?php include_partial('global/pager', array('pager'     => $pager, 'routeName' => 'category')) ?>

